// ==UserScript==
// @name         登录WISH
// @namespace 	 test
// @version      1.0.0
// @description  测试
// @author       Zoro.Zhu
// @include      https://merchant.wish.com/*
// @exclude      *://*.eggvod.cn/*
// @connect      *
// @require      https://code.jquery.com/jquery-2.1.4.min.js
// @grant        window.close
// ==/UserScript==


(function() {
    var url = window.location.href;
    if(url.indexOf("login") >= 0){
        $('#username-box').val('lntdpl');
        $('#password-box').val('Zhuyh199400');
        setTimeout(function(){
            $('.login-text').click();
        },2000);
    } else if (url.indexOf("welcome") >= 0){
        window.open('https://merchant.wish.com/login');
    } else if (url.indexOf("account-balance") >= 0){
        var a = [];
        var i = 0;
        var b = 0;
        var int=self.setInterval(function () {
            $('section').each(function(){
                a[i] = $(this).text();
                i++;
                b = 1;
            });
            if(b === 1) {
                console.log(a);
                window.open('https://merchant.wish.com/logout');
            }
        },5000);
    } else {
        window.open('https://merchant.wish.com/account-balance');
    }

})();

